# -*- coding: utf-8 -*-
# author: sixmillions
# date: 2022/04/08

"""
requests 代理使用方式
先按安装：conda install requests
https://www.cnblogs.com/yuxuanlian/p/10139659.html
"""
import requests

proxy = '123.58.10.36:8080'  # 本地代理
# proxy='username:password@123.58.10.36:8080' # 购买代理
proxies = {
    'http': 'http://' + proxy,
    'https': 'https://' + proxy
}
try:
    response = requests.get('http://httpbin.org/get', proxies=proxies)
    print(response.text)
except requests.exceptions.ConnectionError as e:
    print('错误:', e.args)
